package bandi.osgi.server;


import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;

import bandi.osgi.dalservice.service.DALService;

import xmlwriter.XMLCreatorExample;

public class ServerActivator implements BundleActivator {
	private Server server;
	private ServiceReference myServiceReference;
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		XMLCreatorExample xce = new XMLCreatorExample();
		System.out.println("starting test..");
		myServiceReference = context.getServiceReference(DALService.class.getName());
		DALService ds = (DALService) context.getService(myServiceReference);
		server = new Server(xce,ds);
		server.start();
		
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		server.stop();

	}

}
